<?php 
header("content-type:text/html;charset=utf8");
$u_name=$_POST["u_name"];
$u_pwd=$_POST["u_pwd"];
// print_r($u_name);die;
//连接库
$db=new PDO("mysql:host=127.0.0.1;dbname=bj07c;charset=utf8","root","root");
$sql="select * from users where u_name='$u_name' and u_pwd='$u_pwd'";
// print_r($sql);die;
$res=$db->query($sql)->fetch(PDO::FETCH_ASSOC);
// print_r($res);die;
if($res)
{
  $arr=array("code"=>1,"msg"=>"登录成功");
}else
{
$arr=array("code"=>2,"msg"=>"登录失败");
}
echo json_encode($arr);
 ?>
